/// <reference path="headers.ts" />/// <reference path="io.ts" />module pe.unmanaged {
export class DllExport {
name: string;
ordinal: number;
// The address of the exported symbol when loaded into memory, relative to the image base. // For example, the address of an exported function.exportRva: number;
// Null-terminated ASCII string in the export section.
// This string must be within the range that is given by the export table data directory entry.
// This string gives the DLL name and the name of the export (for example, "MYDLL.expfunc")
// or the DLL name and the ordinal number of the export (for example, "MYDLL.#27").forwarder: string;
static readExports(reader: io.BufferReader, range: io.AddressRange): DllExports {
var result: DllExports = <any>[];
result.flags = reader.readInt();
if (!result.timestamp)
result.timestamp = new Date(0);
result.timestamp.setTime(reader.readInt() * 1000);
var majorVersion = reader.readShort();
var minorVersion = reader.readShort();
result.version = majorVersion + "." + minorVersion;
// need to read string from that RVA later
var nameRva = reader.readInt();
result.ordinalBase = reader.readInt();
// The number of entries in the export address table.var addressTableEntries = reader.readInt();
// The number of entries in the name pointer table. This is also the number of entries in the ordinal table.var numberOfNamePointers = reader.readInt();
// The address of the export address table, relative to the image base.var exportAddressTableRva = reader.readInt();
// The address of the export name pointer table, relative to the image base. // The table size is given by the Number of Name Pointers field.var namePointerRva = reader.readInt();
// The address of the ordinal table, relative to the image base.var ordinalTableRva = reader.readInt();
if (nameRva == 0) {
result.dllName = null;
}
else {var saveOffset = reader.offset;
reader.setVirtualOffset(nameRva);
result.dllName = reader.readAsciiZ();
reader.offset = saveOffset;
}